package com.jic.member.impl;

import java.lang.Long;
import java.util.List;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.member.entity.MememberLegalLogisticsIncrement;
import com.jic.member.mapper.MememberLegalLogisticsIncrementMapper;
import com.jic.member.service.MememberLegalLogisticsIncrementService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 会员等级管理-权益规则-物流权益递增表
 * @author : 
 * @email : 
 * @since : 2020-04-02 07:44:08
 * @version : v1.0.0
 */
@Service
public class MememberLegalLogisticsIncrementServiceImpl implements MememberLegalLogisticsIncrementService{

    @Autowired
    private MememberLegalLogisticsIncrementMapper mememberLegalLogisticsIncrementMapper;

    @Override
    public long insert(MememberLegalLogisticsIncrement mememberLegalLogisticsIncrement) {
        long flag = mememberLegalLogisticsIncrementMapper.insert(mememberLegalLogisticsIncrement);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return mememberLegalLogisticsIncrementMapper.delete(id);
    }

    @Override
    public long update(MememberLegalLogisticsIncrement mememberLegalLogisticsIncrement) {
        return mememberLegalLogisticsIncrementMapper.update(mememberLegalLogisticsIncrement);
    }

    @Override
    public MememberLegalLogisticsIncrement queryByPrimaryKey(Long id){
        return mememberLegalLogisticsIncrementMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<MememberLegalLogisticsIncrement> query(MememberLegalLogisticsIncrement mememberLegalLogisticsIncrement){
        return mememberLegalLogisticsIncrementMapper.query(mememberLegalLogisticsIncrement);
    }

    @Override
    public PageResult<MememberLegalLogisticsIncrement> queryPage(MememberLegalLogisticsIncrement mememberLegalLogisticsIncrement, Page pageQuery) {
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<MememberLegalLogisticsIncrement> list = mememberLegalLogisticsIncrementMapper.queryPage(startIndex, pageQuery.getLimit(), mememberLegalLogisticsIncrement);
        long count = mememberLegalLogisticsIncrementMapper.queryPageCount(mememberLegalLogisticsIncrement);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}